<!-- 空调 not use-->
<template>
  <a-modal :visible="show" :mask-closable="false" :title="title" :footer="null" @cancel="closeHandle">
    <a-tabs animated hide-add size="small" type="card">
      <a-tab-pane key="1" tab="设备控制">
        <div class="row">
          <span>控制状态</span>
          <span>远方</span>
        </div>
        <div>
          <a-space>
            <a-button @click="onClickBp('1')">变频启动控制</a-button>
            <a-button @click="onClickBp('2')">变频停止控制</a-button>
          </a-space>
        </div>
      </a-tab-pane>
      <a-tab-pane key="2" tab="设备调节">
        <div class="row">
          <span>控制状态：</span>
          <span>远方</span>
        </div>

        <div class="row">
          <span>频率设定：</span>
          <a-space>
            <div class="flex flex-row flex-nowrap">
              <a-input v-model:value="pl" placeholder="请输入频率"></a-input> <span class="ml-2">Hz</span>
            </div>
            <a-button @click="onClickPl">频率设定</a-button>
          </a-space>
        </div>
      </a-tab-pane>
      <a-tab-pane key="3" tab="设备状态">
        <div v-for="(n, i) in mockList" :key="i" class="node-list">
          <a-space class="flex justify-between">
            <span>{{ n.name }}</span>
            <a-button class="">{{ n.status }}</a-button>
          </a-space>
        </div>
      </a-tab-pane>
      <a-tab-pane key="4" tab="设备信息">
        <div class="row">
          <span>设备名称：</span>
          <span>组合空调箱TK/KT-1514-B1</span>
        </div>
        <div class="row">
          <span>设备代码：</span>
          <span>OGLLEMCS_ZKTX002</span>
        </div>
        <div class="row">
          <span>安装位置：</span>
          <span>桂林路</span>
        </div>
        <div class="row">
          <span>图纸代码：</span>
          <span></span>
        </div>
        <div class="row">
          <span>位置信息：</span>
          <span></span>
        </div>
      </a-tab-pane>
    </a-tabs>
  </a-modal>
</template>
<script setup>
import { ref, computed } from "vue";
import { userStore } from "@/store/modules/userStore";

const emit = defineEmits(["update:show"]);

const store = userStore();

const props = defineProps({
  data: {
    type: Object,
    required: true,
    default: () => ({})
  },
  show: {
    type: Boolean,
    required: true,
    default: false
  }
});

const title = computed(() => {
  return "桂林路-" + "组合空调箱TK" + props.data.deviceCode;
});

const pl = ref();

const mockList = [
  {
    name: "组合空调箱TK/KT-1514-B1工频运行状态",
    status: "停止"
  },
  {
    name: "组合空调箱TK/KT-1514-B1工频停止状态",
    status: "停止"
  },
  {
    name: "组合空调箱TK/KT-1514-B1火灾模式执行反馈",
    status: "信号消失"
  },
  {
    name: "组合空调箱TK/KT-1514-B1工频过载状态",
    status: "正常"
  },
  {
    name: "组合空调箱TK/KT-1514-B1工频运行状态",
    status: "停止"
  },
  {
    name: "组合空调箱TK/KT-1514-B1冷却风扇运行",
    status: "运行"
  },
  {
    name: "组合空调箱TK/KT-1514-B1火灾工频运行控制",
    status: "关闭"
  }
];
const closeHandle = () => {
  emit("update:show", false);
};
function onClickBp(active) {
  store.changeOperateList({
    index: props.data.index,
    currentComName: props.data.currentComName,
    active: active === "1"
  });
}

function onClickPl() {
  store.changeOperateList({
    index: props.data.index,
    currentComName: props.data.currentComName,
    active: value.value === "1",
    air_pl: pl.value //todo: 空调转速
  });
}
</script>
<style scoped lang="less">
.row {
  display: flex;
  flex-flow: row nowrap;
  height: 40px;
  line-height: 40px;
  span {
    margin-right: 6px;
  }
}
.node-list {
  height: 40px;
  line-height: 40px;
}
</style>
